<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%String path=request.getContextPath();String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<title><s:text name="sys.app_title" /></title>
	<%@include file="../include/contentheader.jsp"%>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <link rel="stylesheet" type="text/css" href="css/dtree.css"/>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="js/dtree.js"></script>
	<script type="text/javascript" src="js/app.js"></script>
	<script type="text/javascript" src="dwr/engine.js"></script>
    <script type="text/javascript" src="dwr/util.js"></script>
    <script type="text/javascript" src="dwr/interface/department.js"></script>
 <script type="text/javascript">
/******************资产计量单位*************************/
//将资产计量单位数据导出
function ExportAssetMeasurementUnitExcel(){
	 if(confirm("确定要导出所有记录吗?")){
         window.location.href="outputAssetMeasurementUnit.action";
	   } 
}
//修改资产计量单位function
function updateAssetMeasurementUnit(){
	 var allId = document.getElementsByName("checkbox");
     var array = new Array(allId.length);
     var j=0;
     for(var i=0;i<allId.length;i++){
        if(allId[i].checked==true){
             array[j] = allId[i].value;
             j++;
        }
     }
     //如果没有被选中，那么不进行任何操作
     if(j==0){
   	   alert('请选择要进行修改的记录.');
          return;
          }
     var newArray = new Array(j);
     for(var i=0;i<j;i++){
         newArray[i]=array[i];
     }
     if(j > 1){
			alert('请选择某一条具体的记录再进行此操作.');
			return false;
		}
        document.getElementById("updateAssetMeasurementUnit").value = newArray; 
        document.getElementById("updateform").submit();
}
//删除资产计量单位的function
function deleteAssetMeasurementUnit(){
	 var allId = document.getElementsByName("checkbox");
     var array = new Array(allId.length);
     var j=0;
     for(var i=0;i<allId.length;i++){
        if(allId[i].checked==true){
             array[j] = allId[i].value;
             j++;
        }
     }
     //如果没有被选中，那么不进行任何操作
     if(j==0){
   	   alert('请选择要进行删除的记录.');
          return;
          }
     var newArray = new Array(j);
     for(var i=0;i<j;i++){
         newArray[i]=array[i];
     }
     if(confirm("确定要删除所选的记录吗？删除之后数据将不能恢复!")){
        document.getElementById("hiddenAssetMeasurementUnitid").value = newArray; 
        document.getElementById("hiddenform").submit();
     }
}
//根据条件查询资产计量单位
function queryAssetMeasurementUnit(){
 	       var property=document.getElementById("condition");
		   var condition=property.options[property.selectedIndex].value;
		if(condition=="zt"){
			var propertyBeChoose=document.getElementById("acstatusValue");
			var acstatusValue=propertyBeChoose.options[propertyBeChoose.selectedIndex].value;
			location.href = "queryAssetMeasurementUnit.action?param=1&condition="+encodeURIComponent($('#condition').val())+"&acstatusValue="+encodeURIComponent($('#acstatusValue').val());   
		}else{
			var conditionValue=document.getElementById("conditionValue").value;
  	    location.href="queryAssetMeasurementUnit.action?param=1&condition="+encodeURIComponent($('#condition').val())+"&conditionValue="+encodeURIComponent($('#conditionValue').val());   
		}
 		 }



/******************会计科目*************************/
//将会计科目数据导出
function ExportAccountingSubjectExcel(){
	 if(confirm("确定要导出所有记录吗?")){
         window.location.href="outputAccountingSubject.action";
	   } 
}
//修改会计科目function
function updateAccountingSubject(){
	 var allId = document.getElementsByName("checkbox");
     var array = new Array(allId.length);
     var j=0;
     for(var i=0;i<allId.length;i++){
        if(allId[i].checked==true){
             array[j] = allId[i].value;
             j++;
        }
     }
     //如果没有被选中，那么不进行任何操作
     if(j==0){
   	   alert('请选择要进行修改的记录.');
          return;
          }
     var newArray = new Array(j);
     for(var i=0;i<j;i++){
         newArray[i]=array[i];
     }
     if(j > 1){
			alert('请选择某一条具体的记录再进行此操作.');
			return false;
		}
        document.getElementById("updateAccountingSubject").value = newArray; 
        document.getElementById("updateAccountingSubjectform").submit();
}
//删除会计科目的function
function deleteAccountingSubject(){
	 var allId = document.getElementsByName("checkbox");
     var array = new Array(allId.length);
     var j=0;
     for(var i=0;i<allId.length;i++){
        if(allId[i].checked==true){
             array[j] = allId[i].value;
             j++;
        }
     }
     //如果没有被选中，那么不进行任何操作
     if(j==0){
   	   alert('请选择要进行删除的记录.');
          return;
          }
     var newArray = new Array(j);
     for(var i=0;i<j;i++){
         newArray[i]=array[i];
     }
    
     if(confirm("确定要删除所选的记录吗？删除之后数据将不能恢复!")){
        document.getElementById("hiddenAccountingSubjectid").value = newArray; 
        document.getElementById("hiddenAccountingSubjectform").submit();
     }
}
//根据条件查询会计科目
function queryAccountingSubject(){
 	       var property=document.getElementById("condition");
		   var condition=property.options[property.selectedIndex].value;
		if(condition=="zt"){
			var propertyBeChoose=document.getElementById("acstatusValue");
			var acstatusValue=propertyBeChoose.options[propertyBeChoose.selectedIndex].value;
			location.href = "queryAccountingSubject.action?param=3&condition="+encodeURIComponent($('#condition').val())+"&acstatusValue="+encodeURIComponent($('#acstatusValue').val());   
		}else{
			var conditionValue=document.getElementById("conditionValue").value;
  	    location.href="queryAccountingSubject.action?param=3&condition="+encodeURIComponent($('#condition').val())+"&conditionValue="+encodeURIComponent($('#conditionValue').val());   
		}
 		 }



/******************资产状态信息*************************/
//将资产状态数据导出
function ExportProdStatusMstExcel(){
	 if(confirm("确定要导出所有记录吗?")){
       window.location.href="outputProdStatusMst.action";
	   } 
}
//修改资产状态function
function updateProdStatusMst(){
	 var allId = document.getElementsByName("checkbox");
   var array = new Array(allId.length);
   var j=0;
   for(var i=0;i<allId.length;i++){
      if(allId[i].checked==true){
           array[j] = allId[i].value;
           j++;
      }
   }
   //如果没有被选中，那么不进行任何操作
   if(j==0){
 	   alert('请选择要进行修改的记录.');
        return;
        }
   var newArray = new Array(j);
   for(var i=0;i<j;i++){
       newArray[i]=array[i];
   }
   if(j > 1){
			alert('请选择某一条具体的记录再进行此操作.');
			return false;
		}
      document.getElementById("updateProdStatusMst").value = newArray; 
      document.getElementById("updateProdStatusMstform").submit();
}
//删除资产状态的function
function deleteProdStatusMst(){
	 var allId = document.getElementsByName("checkbox");
   var array = new Array(allId.length);
   var j=0;
   for(var i=0;i<allId.length;i++){
      if(allId[i].checked==true){
           array[j] = allId[i].value;
           j++;
      }
   }
   //如果没有被选中，那么不进行任何操作
   if(j==0){
 	   alert('请选择要进行删除的记录.');
        return;
        }
   var newArray = new Array(j);
   for(var i=0;i<j;i++){
       newArray[i]=array[i];
   }
  
   if(confirm("确定要删除所选的记录吗？删除之后数据将不能恢复!")){
      document.getElementById("hiddenProdStatusMstid").value = newArray; 
      document.getElementById("hiddenProdStatusMstform").submit();
   }
}
//根据条件查询资产状态
function queryProdStatusMst(){
	       var property=document.getElementById("condition");
		   var condition=property.options[property.selectedIndex].value;
		if(condition=="zt"){
			var propertyBeChoose=document.getElementById("acstatusValue");
			var acstatusValue=propertyBeChoose.options[propertyBeChoose.selectedIndex].value;
			location.href = "queryProdStatusMst.action?param=2&condition="+encodeURIComponent($('#condition').val())+"&acstatusValue="+encodeURIComponent($('#acstatusValue').val());   
		}else{
			var conditionValue=document.getElementById("conditionValue").value;
	    location.href="queryProdStatusMst.action?param=2&condition="+encodeURIComponent($('#condition').val())+"&conditionValue="+encodeURIComponent($('#conditionValue').val());   
		}
		 }
//条件选择
function chose(){
	var property=document.getElementById("condition");
	var conditionValue=document.getElementById("conditionValue");
	var acstatusValue=document.getElementById("acstatusValue");
	if(property.options[property.selectedIndex].value=="zt"){
		conditionValue.style.display="none";	
		acstatusValue.style.display="inline";
	}else{
		conditionValue.style.display="inline";	
		acstatusValue.style.display="none";
	}
}
</script>
     
  </head>
  
  <body onload="buildTree()">
    <div class="mainContainer">
    <div class="headerTitle">基础信息管理&nbsp;>>&nbsp;其他基础信息管理</div>
        <div class="dtreeDiv" id="myTree">
     <script type="text/javascript">
	       var myTree = document.getElementById("myTree");
	       d = new dTree('d');
	       var inner;
	       var url = "page/basic/basicDataManager.jsp";
	function buildTree() {
	        d.add(0,-1,"广元电业局",url);
            d.add(1,0,"资产计量单位","search.action?param=1"); 
            d.add(2,0,"资产状态","search.action?param=2");
            d.add(3,0,"会计科目","search.action?param=3");   
			inner = d.toString();
			showBuildTree();
	}
	function showBuildTree() {
		myTree.innerHTML = inner;
	}
     </script>

        </div>
 <s:if test="param==1">     
<div class="dataDivLeftHasTree">        
<table class="gridTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
		<td>
			<!-- 功能性操作 -->
			<input type="button" style="margin-left:2px;" value="刷新" onclick="javascript:window.location.href='page/basic/search.action?param=1'"/>
			<input type="button" style="margin-left:2px;" value="新增" onclick="javascript:window.location.href='page/basic/addAssetMeasurementUnit.jsp?param=1'"/>
			<input type="button" style="margin-left:2px;" value="修改" onclick="updateAssetMeasurementUnit()"/>
			<input type="button" style="margin-left:2px;" value="删除" onclick="deleteAssetMeasurementUnit();"/>
			<input type="button" style="margin-left:2px;" value="导出" onclick="ExportAssetMeasurementUnitExcel()"/>
			查询条件：根据&nbsp;&nbsp;
			<select style="width: 120px;"  id="condition" onblur="chose()">
		  			<option selected="selected" value="mc">资产计量单位名称</option>
		  			<option value="zt">资产计量单位状态</option>
		  	</select>
		  	<input style="margin-left:10px;" type="text" id="conditionValue"/>
		  		<select style="display:none;width: 100px" class="qryTxt" id="acstatusValue">
	  				<option value="Y" selected="selected">在用</option>
					<option value="N">弃用</option>
	  			</select>
		  	<input type="button" style="margin-left:1px;" value="查询" onclick="queryAssetMeasurementUnit()"/>
			
		</td>
	</tr>
	<tr>
		<td class="gridData">
		
	        <table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataHeader">
	          	<!-- 数据表头 -->
	          	
	            <td width="6%"><input id="checkAll" type="checkbox" name="check" value="checkbox" /></td>
	            <td width="20%">资产计量单位编号</td>
	            <td width="20%">资产计量单位名称</td>
	            <td width="20%">资产计量单位状态</td>
	          
	          </tr>
	          <!-- 数据 -->
	         <s:iterator var="unit" value="unitpagination.dataList" status="st"> 
	          <tr class="dataRow">
	            <td><input name="checkbox" type="checkbox" value="<s:property value='#unit.unitid'/>" id="selectItem" /></td>
	            <td><s:property value="#st.index+1"/></td>
	            <td><s:property value="#unit.unitname"/></td>
	            <td>
	              <s:if test='#unit.unitstauts=="Y"'>在用</s:if>
	              <s:else>弃用</s:else>
	            </td>
	          </tr>
	      	</s:iterator>
			</table>
	    
		</td>
	</tr>
	   <!-- 分页 -->
              <tr class="dataPager">
		       <td>
			     <s:property value="pageLink" escapeHtml="false" />
		       </td>
	          </tr>
	
</table>
        </div></s:if>
   <s:if test="param==2">         
        
        <div class="dataDivLeftHasTree">        
<table class="gridTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
	<td>
			<!-- 功能性操作 -->
			<input type="button" style="margin-left:2px;" value="刷新" onclick="javascript:window.location.href='page/basic/search.action?param=2'"/>
			<input type="button" style="margin-left:2px;" value="新增" onclick="javascript:window.location.href='page/basic/findAllProdStatusMst.action'"/>
			<input type="button" style="margin-left:2px;" value="修改" onclick="updateProdStatusMst()"/>
			<input type="button" style="margin-left:2px;" value="删除" onclick="deleteProdStatusMst();"/>
			<input type="button" style="margin-left:2px;" value="导出" onclick="ExportProdStatusMstExcel()"/>
			查询条件：根据&nbsp;&nbsp;
			<select style="width: 120px;"  id="condition" onblur="chose()">
		  			<option selected="selected" value="mc">资产状态名称</option>
		  			<option value="zt">资产状态使用情况</option>
		  	</select>
		  	<input style="margin-left:10px;" type="text" id="conditionValue"/>
		  		<select style="display:none;width: 100px" class="qryTxt" id="acstatusValue">
	  				<option value="Y" selected="selected">在用</option>
					<option value="N">弃用</option>
	  			</select>
		  	<input type="button" style="margin-left:1px;" value="查询" onclick="queryProdStatusMst()"/>
			
		</td>
	</tr>
	<tr>
		<td class="gridData">
		
	        <table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataHeader">
	          	<!-- 数据表头 -->
	          	
	            <td width="6%"><input id="checkAll" type="checkbox" name="check" value="checkbox" /></td>
	            <td width="15%">主状态编号</td>
	            <td width="15%">主状态名称</td>
	            <td width="15%">从状态编号</td>
	            <td width="15%">从状态名称</td>
	            <td width="15%">使用状况</td>
	          </tr>
	          <!-- 数据 -->
	         
	         <s:iterator var="status" value="stapagination.dataList"> 
	          <tr class="dataRow">
	            <td><input name="checkbox" type="checkbox" value="<s:property value='#status.seq'/>" id="selectItem" /></td>
	            <td><s:property value="#status.statuscode"/></td>
	            <td><s:property value="#status.statusdesc"/></td>
	             <td><s:property value="#status.subcode"/></td>
	            <td><s:property value="#status.subdesc"/></td>
	            <td>
	              <s:if test='#status.status=="Y"'>在用</s:if>
	              <s:else>弃用</s:else>
	            </td>
	          </tr>
	      	</s:iterator>
			</table>
	    
		</td>
	</tr>
	   <!-- 分页 -->
              <tr class="dataPager">
		       <td>
			     <s:property value="pageLink" escapeHtml="false" />
		       </td>
	          </tr>
	
</table>
        </div>
 </s:if> 
 <s:if test="param==3">
        <div class="dataDivLeftHasTree">        
<table class="gridTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
	<td>
			<!-- 功能性操作 -->
			<input type="button" style="margin-left:2px;" value="刷新" onclick="javascript:window.location.href='page/basic/search.action?param=3'"/>
			<input type="button" style="margin-left:2px;" value="新增" onclick="javascript:window.location.href='page/basic/addAccountingSubject.jsp?param=3'"/>
			<input type="button" style="margin-left:2px;" value="修改" onclick="updateAccountingSubject()"/>
			<input type="button" style="margin-left:2px;" value="删除" onclick="deleteAccountingSubject();"/>
			<input type="button" style="margin-left:2px;" value="导出" onclick="ExportAccountingSubjectExcel()"/>
			查询条件：根据&nbsp;&nbsp;
			<select style="width: 120px;"  id="condition" onblur="chose()">
		  			<option selected="selected" value="mc">会计科目名称</option>
		  			<option value="zt">会计科目状态</option>
		  	</select>
		  	<input style="margin-left:10px;" type="text" id="conditionValue"/>
		  		<select style="display:none;width: 100px" class="qryTxt" id="acstatusValue">
	  				<option value="Y" selected="selected">在用</option>
					<option value="N">弃用</option>
	  			</select>
		  	<input type="button" style="margin-left:1px;" value="查询" onclick="queryAccountingSubject()"/>
			
		</td>
	
	</tr>
	<tr>
		<td class="gridData">
		
	        <table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataHeader">
	          	<!-- 数据表头 -->
	          	
	            <td width="6%"><input id="checkAll" type="checkbox" name="check" value="checkbox" /></td>
	            <td width="20%">会计科目编号</td>
	            <td width="20%">会计科目名称</td>
	            <td width="20%">会计科目状态</td>
	          
	          </tr>
	          <!-- 数据 -->
	         
	         <s:iterator var="sub" value="subpagination.dataList" status="st"> 
	          <tr class="dataRow">
	            <td><input name="checkbox" type="checkbox" value="<s:property value='#sub.subid'/>" id="selectItem" /></td>
	            <td><s:property value="#st.index+1"/></td>
	            <td><s:property value="#sub.subname"/></td>
	            <td>
	              <s:if test='#sub.substatus=="Y"'>在用</s:if>
	              <s:else>弃用</s:else>
	            </td>
	          </tr>
	      	</s:iterator>
			</table>
	    
		</td>
	</tr>
	   <!-- 分页 -->
              <tr class="dataPager">
		       <td>
			     <s:property value="pageLink" escapeHtml="false" />
		       </td>
	          </tr>
	
</table>
        </div>
        </s:if>     
        
   </div>
<!--************************资产量单位********************************--> 
<!-- 提交删除资产量单位所有Id -->
   <form action="deleteAssetMeasurementUnit.action?param=1" method="post" id="hiddenform">
    	<input type="hidden" id="hiddenAssetMeasurementUnitid" name="unitid"/>
   </form>
<!-- 提交修改根据Id的资产量单位信息 -->
   <form action="findAssetMeasurementUnit.action" method="post" id="updateform">
    	<input type="hidden" id="updateAssetMeasurementUnit" name="unitid"/>
   </form>
 
<!--************************会计科目********************************-->  
 <!-- 提交删除会计科目所有Id -->
     <form action="deleteAccountingSubject.action?param=3" method="post" id="hiddenAccountingSubjectform">
      	<input type="hidden" id="hiddenAccountingSubjectid" name="subid"/>
     </form> 
<!-- 提交修改根据Id的会计科目信息 -->
	 <form action="findAccountingSubject.action" method="post" id="updateAccountingSubjectform">
	    	<input type="hidden" id="updateAccountingSubject" name="subid"/>
	 </form>
	 
<!--************************资产状态********************************-->  
 <!-- 提交删除资产状态所有Id -->
     <form action="deleteProdStatusMst.action?param=2" method="post" id="hiddenProdStatusMstform">
      	<input type="hidden" id="hiddenProdStatusMstid" name="statusid"/>
     </form> 
<!-- 提交修改根据Id的资产状态信息 -->
	 <form action="findProdStatusMst.action" method="post" id="updateProdStatusMstform">
	    	<input type="hidden" id="updateProdStatusMst" name="statusid"/>
	 </form>	 
</body>
</html>